#FROM alpine:3.6
FROM golang:1.8 AS builder

MAINTAINER Zhang huaqiao <yhzhq1989@163.com>

WORKDIR /go/src/edgex-club/

RUN go get gopkg.in/mgo.v2/bson
RUN go get github.com/gorilla/mux

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o edgex-club-linux

FROM alpine:3.4  

RUN cp /etc/apk/repositories /etc/apk/repositories.bak
RUN echo "https://mirrors.ustc.edu.cn/alpine/v3.6/main" > /etc/apk/repositories
RUN echo "https://mirrors.ustc.edu.cn/alpine/v3.6/community" >> /etc/apk/repositories
RUN cat /etc/apk/repositories

RUN apk --no-cache add ca-certificates

WORKDIR /edgex-club/
COPY --from=builder /go/src/edgex-club/edgex-club-linux .
COPY --from=builder /go/src/edgex-club/static ./static/

EXPOSE 8080

ENTRYPOINT ["./edgex-club-linux"]




